package cn.edu.scau.cmi.liangzijian.hibernate.domain;

import java.io.Serializable;
import java.util.HashSet;
import java.util.Set;

public class Teacher implements Serializable {
	private int id;
	private String name;
	private Set<Student> students = new HashSet<Student>();
	
	public Teacher() {
	}	
	
	public int getId() {
		return id;
	}
	
	public void setId(int id) {
		this.id = id;
	}
	
	public String getName() {
		return name;
	}
	
	public void setName(String name) {
		this.name = name;
	}
	
	public Set<Student> getStudents() {
		return students;
	}
	
	public void setStudents(Set<Student> students) {
		this.students = students;
	}
	
	public boolean addStudent(Student student) {
		return students.add(student);
	}
	
	@Override
	public String toString() {
		return "Id: " + id + "    名字: " + name;
	}
}
